﻿using Microsoft.Extensions.ObjectPool;
using Newtonsoft.Json;

namespace Zeus.Mvc.Internal
{
    public class JsonSerializerObjectPolicy : IPooledObjectPolicy<JsonSerializer>
    {
        private readonly JsonSerializerSettings _serializerSettings;
        public JsonSerializerObjectPolicy(JsonSerializerSettings jsonSerializerSettings)
        {
            _serializerSettings = jsonSerializerSettings;
        }
        public JsonSerializer Create() => JsonSerializer.Create(_serializerSettings);

        public bool Return(JsonSerializer jsonSerializer) => true;
    }
}
